<?php
/**
 * Created by PhpStorm.
 * User: sunqiang
 * Date: 14-11-6
 * Time: 下午9:07
 */

/* 活动配置
 * @package module
 * @subpackage activity
 * @author sunqiang<allen.qiang@fistforward.com>
 * */
class activityConfig {

    private $config_code = null;
    private $config_array = array();


    function  __construct( $config_code )
    {
        $this->config_code = $config_code ;
        $this->init($config_code);
    }

    /* 获取活动的配置信息
     * $config_code 活动编号
     * @author sunqiang<allen.qiang@fistforward.com>
     * */
    private function init($config_code) {
        global $G_SHOP;
        $config_array = $G_SHOP->DBCA->stmt_query('SELECT * FROM activity_config WHERE config_code = ?','s',array($config_code));
        if($config_array)
        {
            foreach($config_array as $config)
            {
                $this->config_array[$config->config_key] = $config->config_value;
            }
        }
    }

    public function __get($name) {
        switch ($name) {
            case 'config' :
                return $this->config_array;
                break;
            case 'config_code' :
                return $this->$config_code;
                break;
            default :
                return null;
                break;
        }
    }


}